/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package gmovil_jpa.entidades;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author castlerock
 */
@Entity
@Table(name = "modelo_plan")
@NamedQueries({
    @NamedQuery(name = "ModeloPlan.findAll", query = "SELECT m FROM ModeloPlan m"),
    @NamedQuery(name = "ModeloPlan.findByIdModeloPlan", query = "SELECT m FROM ModeloPlan m WHERE m.idModeloPlan = :idModeloPlan"),
    @NamedQuery(name = "ModeloPlan.findByPrecioVentaMovil", query = "SELECT m FROM ModeloPlan m WHERE m.precioVentaMovil = :precioVentaMovil"),
    @NamedQuery(name = "ModeloPlan.findByDescuento", query = "SELECT m FROM ModeloPlan m WHERE m.descuento = :descuento"),
    @NamedQuery(name = "ModeloPlan.findByIva", query = "SELECT m FROM ModeloPlan m WHERE m.iva = :iva"),
    @NamedQuery(name = "ModeloPlan.findByActivo", query = "SELECT m FROM ModeloPlan m WHERE m.activo = :activo")})
public class ModeloPlan implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_modelo_plan")
    private Integer idModeloPlan;
    @Basic(optional = false)
    @Column(name = "precio_venta_movil")
    private double precioVentaMovil;
    @Basic(optional = false)
    @Column(name = "descuento")
    private double descuento;
    @Basic(optional = false)
    @Column(name = "iva")
    private double iva;
    @Basic(optional = false)
    @Column(name = "activo")
    private boolean activo;
    @JoinColumn(name = "fid_plan", referencedColumnName = "id_plan")
    @ManyToOne(optional = false)
    private Plan plan;
    @JoinColumn(name = "fid_modelo", referencedColumnName = "id_modelo")
    @ManyToOne(optional = false)
    private Modelo modelo;

    public ModeloPlan() {
    }

    public ModeloPlan(Integer idModeloPlan) {
        this.idModeloPlan = idModeloPlan;
    }

    public ModeloPlan(Integer idModeloPlan, double precioVentaMovil, double descuento, double iva, boolean activo) {
        this.idModeloPlan = idModeloPlan;
        this.precioVentaMovil = precioVentaMovil;
        this.descuento = descuento;
        this.iva = iva;
        this.activo = activo;
    }

    public Integer getIdModeloPlan() {
        return idModeloPlan;
    }

    public void setIdModeloPlan(Integer idModeloPlan) {
        this.idModeloPlan = idModeloPlan;
    }

    public double getPrecioVentaMovil() {
        return precioVentaMovil;
    }

    public void setPrecioVentaMovil(double precioVentaMovil) {
        this.precioVentaMovil = precioVentaMovil;
    }

    public double getDescuento() {
        return descuento;
    }

    public void setDescuento(double descuento) {
        this.descuento = descuento;
    }

    public double getIva() {
        return iva;
    }

    public void setIva(double iva) {
        this.iva = iva;
    }

    public boolean getActivo() {
        return activo;
    }

    public void setActivo(boolean activo) {
        this.activo = activo;
    }

    public Plan getPlan() {
        return plan;
    }

    public void setPlan(Plan plan) {
        this.plan = plan;
    }

    public Modelo getModelo() {
        return modelo;
    }

    public void setModelo(Modelo modelo) {
        this.modelo = modelo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idModeloPlan != null ? idModeloPlan.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ModeloPlan)) {
            return false;
        }
        ModeloPlan other = (ModeloPlan) object;
        if ((this.idModeloPlan == null && other.idModeloPlan != null) || (this.idModeloPlan != null && !this.idModeloPlan.equals(other.idModeloPlan))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "gmovil_jpa.entidades.ModeloPlan[idModeloPlan=" + idModeloPlan + "]";
    }

}
